home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Development Platforms / MPW Related / Animated Cursors / AnimCursor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-14  |  4.9 KB  |  101 lines  |  [TEXT/MPS ]

  1. #ifndef _animcursor_
  2. #define _animcursor_
  3. /***************************************************************************************************\
  4. * AnimCursor - The Animated Cursor Library
  5. *
  6. *     AnimCursor is a small library of four routines which allow a program to animate the cursor by
  7. * showing a series of CURS or crsr resources.  Resources of the type 'acur' are used to keep a list
  8. * of the cursors which will be displayed during the cursor animation.  The acur resource was
  9. * introduced a few Finders ago to animate the watch cursor.
  10. *
  11. *     The acur resource doesn’t contain the cursors themselves.  Instead, it contains a list of the
  12. * the resource IDs of the CURS or crsr resources to be used.  The structure of an acur resource is
  13. * like this:
  14. *
  15. * 2 bytes -  This is the number of cursors to be used in the animation
  16. * 2 bytes -  The lowest 15 bits of this field is the index in the cursor list of the next cursor to
  17. *            be used in the animation.  In the resource file, you should place the index in the
  18. *            cursor list of the first cursor to be displayed in the animation.  The highest bit is a
  19. *            flag.  If you clear this bit, CURS resources will be used in the animation.  If you set
  20. *            this bit, crsr (color cursor) resources will be used.
  21. * The Rest - This is the cursor list.  It holds as many elements as the count field indicates.  Each
  22. *            element is four bytes long.  The first two bytes of each element holds the resource ID
  23. *            of the CURS or crsr resource to use.  The other two bytes are padding.  When the acur
  24. *            resource is in memory, these two padding bytes and the two bytes for the CURS or crsr
  25. *            resource ID are combined to hold a handle to the CURS or crsr in memory.
  26. \***************************************************************************************************/
  27.  
  28.  
  29. /***************************************************************************************************\
  30. * Header Files
  31. \***************************************************************************************************/
  32.  
  33. #ifndef __QUICKDRAW__
  34. #include <Quickdraw.h>
  35. #endif
  36.  
  37.  
  38. /***************************************************************************************************\
  39. * Type Declarations
  40. \***************************************************************************************************/
  41.  
  42. /* acur Resource Template */
  43. typedef struct
  44.     {
  45.     short      count;      /* Number of cursors or “frames” in the cursor list */
  46.     short      frame;      /* Cursor list index of the next cursor frame */
  47.     CursHandle cursors []; /* Variable-sized list of cursor handles */
  48.     } AnimCursRec, *AnimCursPtr, **AnimCursHnd;
  49.  
  50.  
  51. /***************************************************************************************************\
  52. * Function Prototypes
  53. *
  54. * GetAnimCurs
  55. * -----------
  56. *     A handle to the animated cursor list having the resource ID given in AnimCursID and the
  57. * resource type of 'acur' is returned.  The cursor list contains a list of resource IDs of the
  58. * cursors to use.  GetAnimCurs will read in each CURS or crsr resource and replace the resource ID
  59. * in the list with a handle to the corresponding CURS or crsr resource.  If the high bit of the frame
  60. * field is set, GetAnimCurs will load in crsr resources, otherwise it will load in CURS resources.
  61. *
  62. * AnimateCurs
  63. * -----------
  64. *     The animated cursor list specified by AnimCurs is advanced one frame.  This displays the cursor
  65. * whose handle in the cursor list is at the index specified by the frame field.  The frame field is
  66. * then incremented.  If the frame field is incremented past the end of the cursor list, it is wrapped
  67. * around to the beginning of the list again.  The high bit of the frame field (indicating whether to
  68. * use CURS or crsr resources) is retained.
  69. *
  70. * Example:
  71. *     FOR I := 1 TO 500 DO
  72. *       AnimateCurs (MyCursList);
  73. *
  74. *     This example will simply display 500 frames of the animated cursor list specified by
  75. * MyCursList.
  76. *
  77. * AnimateProgCurs
  78. * ---------------
  79. *     One frame of the cursor list specified by AnimCurs is displayed depending on the value of Val.
  80. * This call can be used to have to cursor display the progress of a long operation.  Min specifies
  81. * the minimum value of Val, Max specifies the maximum value of Val, and (of course) Val is the
  82. * current value of Val.  If, for example, Min = 1, Max = 500, and Val = 100, and AnimCurs contains
  83. * ten cursors, AnimateProgCurs will display the second cursor.  The value of the frame field is
  84. * unchanged.
  85. *
  86. * Example:
  87. *     Min := 1;
  88. *     Max := 500;
  89. *     FOR Val := Min TO Max DO
  90. *       AnimateProgCurs (MyCursList, Min, Max, Val);
  91. *
  92. \***************************************************************************************************/
  93.  
  94. pascal AnimCursHnd GetAnimCurs (short AnimCursID);
  95. pascal void        AnimateCurs (AnimCursHnd AnimCurs);
  96. pascal void        AnimateProgCurs (AnimCursHnd AnimCurs, short Min, short Max, short Val);
  97. pascal void        DisposeAnimCurs (AnimCursHnd AnimCurs);
  98.  
  99.  
  100. #endif
  101.